<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>${userutil.username}的个人空间</title>
<style>
.hide{
display:none;
}
#head{
	width:400px;
	height:400px;
}
</style>
<script language="javascript" src="JS/jquery-3.1.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//	alert("in");
	$("#change").addClass("hide");
	//进行修改
	$("#change_infor").bind("click",function(){
		$("#change").removeClass("hide");
		$("#display_div").addClass("hide");
	});
	//返回修改
	$("#back_change").bind("click",function(){
		$("#change").addClass("hide");
		$("#display_div").removeClass("hide");
		//$("#res").click();
	});
	//提交修改
	$("#submit_change").bind("click",function(){
	 $.ajax({
         type: "POST",
         url: "/baike/sdubaike/changeInformation",
         data: new FormData($('#form1')[0]),
 			 processData: false,
 			cache: false,
 			contentType: false,
         success: function(data) {
             alert(data); 
             window.location.reload();
         },
         error: function(XMLHttpRequest, textStatus, errorThrown) {
             alert("上传失败，请检查网络后重试");
         }
     });
	});
});                                                                                                                                                            
</script>
</head>
<body>
<div id="display_div">
	<h1>Hello,${userutil.username}</h1>
	头像：
	<img alt="${userutil.username}的头像" src="/baike/head/${userutil.head?userutil.id:0}.jpg" id="head">
	<br>
	一句话介绍:<b>${userutil.intro}</b>
	<br>
	性别：<b>${userutil.gender?'男':'女'}</b>
	<br>
	出生年月日：<b>${userutil.birth}</b>
	<br>
	学院专业:<b>${userutil.profess}</b>
	<br>
	<form action="/baike/sdubaike/changePassword" method="POST">
	
	<input type="submit" id="chaPass" value="修改密码">
	</form>
	<br/>
	<input type="button" id="change_infor" value="修改资料">
	
</div>
<div id="change" >
	<form method="post" id="form1"  action="/baike/sdubaike/changeInformation" encType="multipart/form-data">
       上传头像：<input type="file" name="head" id="upload_head"><br>
	一句话介绍:<input type="text" name="introduce" id="introduce" value="${userutil.intro}"><br>
	性别：<input type="radio" name="gender" ${userutil.gender?'checked':''} value="1" id="gender"/>男
	<input type="radio" name="gender" value="0" ${!userutil.gender?'checked':''} id="gender"/>女<br>
	出生年月日：<input type="text" name="birth" id="birth" value="${userutil.birth}"><br>
	学院专业:<input type="text" name="profess" id="profess" value="${userutil.profess}">
	<input type="submit" value="提交">
	<br/>
	<input type="button" value="提交修改" id="submit_change">
	<input type="button" value="返回" id="back_change">
	<input id="res" name="res" type="reset" style="display:none;" />  
	
	</form>
<br/>
</div>
	
	<form action="/baike/getEntry">
	<input type="submit" value="查看词条">
	</form>

	
</body>
</html>